document.addEventListener("DOMContentLoaded", function () {
  document.getElementById("btn").addEventListener("click", handler);
  document.getElementById("btn2").addEventListener("click", handler2);
});

function handler() {
  chrome.tabs.query(
    {
      active: true,
      currentWindow: true
    },
    tabs => {
      let message = {
        action: 'current',
        tabs: tabs
      };
      chrome.tabs.sendMessage(tabs[0].id, message, res => {
        console.log("popup=>content");
        console.log(res);
      });
    }
  );
}
function handler2() {
  chrome.tabs.query(
    {
      active: true,
      currentWindow: true
    },
    tabs => {
      let message = {
        action: 'all'
      };
      chrome.tabs.sendMessage(tabs[0].id, message, res => {
        console.log("popup=>content");
        console.log(res);
      });
    }
  );
}
